#ifdef DUMP_MEMORY_LEAK
#include <vld.h>
#endif
#include "serial_surpport.h"

namespace serial
{
	size_t size(const string& i)
	{
		return sizeof(string::size_type) + i.length();
	}

	void write(ostream& is, const string& i)
	{
		write(is, i.length());
		is.write(i.c_str(), i.length());
	}

	void read(istream& is, string& i)
	{
		size_t sz;
		read(is, sz);
		i.resize(sz);
		is.read(const_cast<char*>(&(*i.begin())), sz);
	}

	size_t serialSize(const string& str) { return sizeof(int) + str.length(); }
}